
<?php $selected = 0 ?>
<!--BLOC01-->

<div class="number">
    <img src="<?php echo $this->baseUrl('img/01.png'); ?>" />
</div>

<form method='post' action='<?php echo $this->baseUrl('index/reservation'); ?>'>
    <div class="block">
        <h2>PrÃ©-rÃ©servation : Ã  quelle reprÃ©sentation souhaitez-vous assister ?</h2>
        <p class="note"><span class="pink">Note</span> : votre prÃ©-rÃ©servation nâ€™est pas dÃ©finitive. Vous pourrez revenir sur le site pour la modifier.</p>

        <?php foreach ($this->representations as $representation): ?>
            
            <div class="representation"> 

                <img src="<?php echo $this->baseUrl('img/xs_' . $representation['spectacle_pathimg']); ?>"  alt="<?php echo $representation['spectacle_nom'] ?>" width="133px" />
                <h3>
                    <?php echo $representation['spectacle_nom'] ?> <br /> 
                    <span class="date"><?php echo strftime("%A %d %B - %H:%M", strtotime($representation['representation_date'] . " " . $representation['representation_time'])) ?></span><br />
                    <a target="_blank"class="lieu"  href="<?php echo $representation['lien_gmap'] ?>"><?php echo $representation['lieu_name'] ?> </a>
                </h3>

                <?php $seat_available = min($representation['seat_maxavailable'] - $representation['seat_reserved'],10) ?>
                
                <?php if ($seat_available < 1) : ?>
                    Plus de place.        
                <?php else: ?>
                    <select name="resa[<?php echo $representation['id_spectacle_has_representation'] ?>]">
                        <?php for ($i = 0; $i <= $seat_available; $i++): ?>
                            <option value="<?php echo $i ?>" <?php if ($i == $selected): ?> SELECTED <?php endif ?>><?php echo $i ?> place<?php if ($i > 1) echo 's' ?></option>
                        <?php endfor ?>
                    </select>
                <?php endif ?>



            </div>
        <?php endforeach ?>

        <!--fin DIV BLOCK-->
    </div>
    <!--BLOC02-->

    <div class="number2">
        <img src="<?php echo $this->baseUrl('img/02.png'); ?>" />
    </div>

    <div class="block2">

        <h2>PrÃ©-rÃ©servation : finalisez votre prÃ©-rÃ©servation en saisissant nom, prÃ©nom et email.</h2>

        <p class="note"><span class="pink">Note</span> : souvenez-vous de lâ€™email utilisÃ©, il vous servira pour modifier votre prÃ©-rÃ©servation le cas Ã©chÃ©ant.</p>

        <label for=""><span class="form">Votre prÃ©nom: </span></label>
        <input class="resa" type="text" name="prenom" <?php if (isset($this->isModify)): ?>READONLY <?php endif ?> 
               <?php if (isset($this->data['prenom']['value'])): ?>  value='<?php echo $this->data['prenom']['value'] ?>'<?php endif ?>/>
               <?php if (isset($this->data['prenom']['errors'])): ?>
                   <?php foreach ($this->data['prenom']['errors'] as $error): ?>
                <span class='formError'><?php echo $error ?></span>
            <?php endforeach ?>
        <?php endif ?>
        <br />


        <label for=""><span class="form">Votre nom: </span></label>
        <input class="resa" type="text" name="nom"    <?php if (isset($this->isModify)): ?>READONLY <?php endif ?> 
               <?php if (isset($this->data['nom']['value'])): ?>  value='<?php echo $this->data['nom']['value'] ?>'<?php endif ?>/>

               <?php if (isset($this->data['nom']['errors'])): ?>
                   <?php foreach ($this->data['nom']['errors'] as $error): ?>
                       <span class='formError'><?php echo $error ?></span>
                   <?php endforeach ?>
               <?php endif ?>
        <br />

        <label for=""><span class="form">Votre email: </span></label>
        <input class="resa" type="text" name="email"  <?php if (isset($this->isModify)): ?>READONLY <?php endif ?> 
               <?php if (isset($this->data['email']['value'])): ?>  value='<?php echo $this->data['email']['value'] ?>'<?php endif ?>/>
               <?php if (isset($this->data['email']['errors'])): ?>
                   <?php foreach ($this->data['email']['errors'] as $error): ?>
                <span class='formError'><?php echo $error ?></span>
            <?php endforeach ?>
        <?php endif ?>
        <br />

        <!--fin DIV BLOCK2-->
    </div>
    <input type="hidden" value="0" name="modify" >

    <input class="action" type='submit' style="background:url(<?php echo $this->baseUrl('img/enregistrer.png'); ?>) no-repeat; border:none; width:350px; height:40px" value="" />
</form>